﻿using CompanyCMS.App_Code;
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CompanyCMS.Admin
{
    public partial class edituser : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btSubmit_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txName.Text) && !string.IsNullOrEmpty(txPwd.Text) && txPwd.Text == txCPwd.Text)
            {
                string error;
                if (CommonBLL.RegUser(txName.Text, txPwd.Text, out error))
                {
                    lblmsg.Text = "注册成功";
                    lblmsg.ForeColor = System.Drawing.Color.Green;
                    lblmsg.Visible = true;
                }
                else
                {
                    lblmsg.Text = error;
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                    lblmsg.Visible = true;
                }
            }
            else
            {
                lblmsg.Text = "用户名或密码不正确";
                lblmsg.ForeColor = System.Drawing.Color.Red;
                lblmsg.Visible = true;
            }
        }

        protected void btCancel_Click(object sender, EventArgs e)
        {
            txName.Text = "";
            txPwd.Text = "";
            txCPwd.Text = "";
            lblmsg.Visible = false;
            lblmsg.Text = "";
        }
    }
}